package com.ruoyi.project.WebMoudle.streamShop.service.impl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.streamShop.mapper.StreamShopMapper;
import com.ruoyi.project.WebMoudle.streamShop.domain.StreamShop;
import com.ruoyi.project.WebMoudle.streamShop.service.IStreamShopService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 商家流水Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-08-15
 */
@Service
public class StreamShopServiceImpl implements IStreamShopService 
{
    @Autowired
    private StreamShopMapper streamShopMapper;

    /**
     * 查询商家流水
     * 
     * @param id 商家流水ID
     * @return 商家流水
     */
    @Override
    public StreamShop selectStreamShopById(Long id)
    {
        return streamShopMapper.selectStreamShopById(id);
    }

    /**
     * 查询商家流水列表
     * 
     * @param streamShop 商家流水
     * @return 商家流水
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<StreamShop> selectStreamShopList(StreamShop streamShop)
    {
        return streamShopMapper.selectStreamShopList(streamShop);
    }

    /**
     * 新增商家流水
     * 
     * @param streamShop 商家流水
     * @return 结果
     */
    @Override
    public int insertStreamShop(StreamShop streamShop)
    {
        streamShop.setCreateTime(DateUtils.getNowDate());
        return streamShopMapper.insertStreamShop(streamShop);
    }

    /**
     * 修改商家流水
     * 
     * @param streamShop 商家流水
     * @return 结果
     */
    @Override
    public int updateStreamShop(StreamShop streamShop)
    {
        return streamShopMapper.updateStreamShop(streamShop);
    }

    /**
     * 删除商家流水对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteStreamShopByIds(String ids)
    {
        return streamShopMapper.deleteStreamShopByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商家流水信息
     * 
     * @param id 商家流水ID
     * @return 结果
     */
    @Override
    public int deleteStreamShopById(Long id)
    {
        return streamShopMapper.deleteStreamShopById(id);
    }

    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<StreamShop> selectReturnList(StreamShop streamShop) {
        return streamShopMapper.selectReturnList(streamShop);
    }

    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public BigDecimal queryReturnMoneySum(StreamShop streamShop) {
        return streamShopMapper.queryReturnMoneySum(streamShop);
    }

    @Override
    public List<Map> queryReturnOrder(Long shopId) {
        return streamShopMapper.queryReturnOrder(shopId);
    }
}
